unit UnSensorType;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UnDataModule, StdCtrls, Mask, DBCtrls, DB, ExtCtrls, Grids, DBGrids;

type
  TSensorTypen = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    DsSensorTypen: TDataSource;
    DBEdit1: TDBEdit;
    Naam: TLabel;
    Label3: TLabel;
    v: TPanel;
    DBNavigator1: TDBNavigator;
    DBGrid1: TDBGrid;
    Panel2: TPanel;
    Button1: TButton;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    aDmDataSets : TDmDataSets;
  public
    property DmDataSets : TDmDataSets read aDmDataSets write aDmDataSets;
  end;

var
  SensorTypen: TSensorTypen;

implementation

{$R *.dfm}

procedure TSensorTypen.Button1Click(Sender: TObject);
begin
  close;
end;

procedure TSensorTypen.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if DmDataSets.CdsSensorTypes.State in [dsEdit,dsInsert] then
  begin
    if MessageDlg('Wijzigingen opslaan?',mtConfirmation,mbYesNo,0) = mrOk then
    begin
      DmDataSets.CdsSensorTypes.Post;
      DmDataSets.CdsSensorTypes.Refresh;
    end;
  end;
  Action := caFree;
end;

end.
